<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@include file="../../common/includeBaseSet.jsp" %>
<%@include file="../../common/operation_forbid.jsp" %>
<%@include file="../../common/jsVersion.jsp"%>
<!DOCTYPE html >
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>客户列表</title>
    <!-- neptune -->
     <link rel="stylesheet" type="text/css"  href="${jypath}/static/ext/resources/ext-theme-gray/ext-theme-gray-all.css" />
     <link rel="stylesheet" type="text/css"  href="${jypath}/static/css/icon.css" />
     <style type="text/css">
     	a {text-decoration:none;}
     </style>
     <script type="text/javascript" src="${jypath}/static/ext/ext-all.js"></script>
	 <script type="text/javascript" src="${jypath}/static/ext/locale/ext-lang-zh_CN.js"></script> 
	 <script type="text/javascript" src="${jypath}/static/js/jquery/json2.js"></script>
	 <script type="text/javascript" src="${jypath}/static/js/customer/customer/list.js?v=${jsVersion}"></script> 
	 <script type="text/javascript">
		var idata = '${permitBtn}';
		var resourcesCode = "${resourcesCode}";
		//var projects = JSON.parse('${projects}');
		//var projectId = "${projectId}";
		var customerTemplet="${customerTemplet}";
		var payDepositOff=${payDepositOff};
/* 		if(projectId!="kong"){
			var projectId2 = parseInt(projectId);
		} */
		var improvenow =${improvenow};

		var cbstore = new Ext.data.Store({
	        singleton:true,
	        autoDestroy:true,
	        fields: ["projectName", "id"],
	        proxy:{
	            type:'ajax',
// 	            url:contextPath+'/customer/follow/returnProjectName?resourcesCode=menu_0003_0001&resourcesName=resName_pro_list',
	            url:contextPath+'/estate/project/findProjectList?resourcesCode=menu_0003_0001&resourcesName=resName_pro_list',
	            reader:{
                   type: 'json', 
                   root: 'root'  //数据
              }
	        } ,
	        autoLoad: false
		});
		//当项目加载完后加载grid数据
		cbstore.load({
			callback:function(records, options, success){
				var data = {"projectName": "全部", "id": '-1'};
				var rs = Ext.create(data);
				cbstore.insert(0, rs);
				var count = cbstore.getCount();
				if(count>0){
					var id=cbstore.getAt(0).get("id");
					Ext.getCmp('cbstore').setValue(id);
                    if(id && id == "-1"){
                        Ext.getCmp("batchFenPei").disable();
                    }
				}
				userIdStore.load({
					callback:function(value){
        				//加载组团数据
        				var count=userIdStore.getCount();
        				if(count>0){
        					var id=userIdStore.getAt(0).get("id");
        					Ext.getCmp('user').setValue(id);
        				}
        			}
				});
			}
		});
		
/* 		var cbstore = new Ext.data.Store({
	    	autoDestroy: true,
	        fields :["projectName","id"],
	    	data : projects
		}); */
		Array.prototype.del=function(n) {　//n表示第几项，从0开始算起。
			//prototype为对象原型，注意这里为对象增加自定义方法的方法。
			　if(n<0)　//如果n<0，则不进行任何操作。
			return this;
			　else
			return this.slice(0,n).concat(this.slice(n+1,this.length));
		}
		 
	  	if(idata!=null||idata!=""){
			idata=JSON.parse(idata);
		}
	  	
	  	var customerView = true ;
	  	var customerEdit = true ;
	  	var customerDelete = true ;
	  	var customerAdd = true;
	  	var customerDistributionConsultant= true;
	  	var customerAddFollow = true;
	  	var customerExport = true;
	  	if(Ext.Array.contains(idata,"customer:customer:view")){
	  		customerView=false;
	  	}
	  	
	  	if(Ext.Array.contains(idata,"customer:customer:edit")){
	  		customerEdit=false;
	  	}
	  	
	  	if(Ext.Array.contains(idata,"customer:customer:delete")){
	  		customerDelete=false;
	  	}
	  	
	  	if(Ext.Array.contains(idata,"customer:customer:distributionConsultant")){
	  		customerDistributionConsultant=false;
	  	}
	  	
	  	if(Ext.Array.contains(idata,"customer:customer:addFollow")){
	  		customerAddFollow=false;
	  	}
	  	if(Ext.Array.contains(idata,"customer:customer:add")){
	  		customerAdd=false;
	  	}
	  	if(Ext.Array.contains(idata,"customer:customer:export")){
	  		customerExport=false;
        }

        var giveUpButton = true;
        if(Ext.Array.contains(idata,"customer:customer:giveUp")){
            giveUpButton=false;
        }
	  	
	 </script>
</head>
<body>
</body>
</html>